#!/usr/bin/env bash
# db-supports_pg_lang -- Creates a PostgreSQL language if it doesn't exist yet
# > eval "$(db-parse "$url")"
# > db-supports_pg_lang LANG
##
set -euo pipefail

Lang=$1; shift

[[ $(db-query "SELECT COUNT(*) FROM pg_catalog.pg_language WHERE lanname = '$Lang'" tsv 0) -gt 0 ]] ||
    db-execute "CREATE LANGUAGE $Lang"
